/**
 * 
 */
package com.shanglida.base;

import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

/**
 * @author maus
 * @deprecated 用于引导leadactivity
 * @date 2014-02-26 PM
 * @version 1.0
 */
public abstract class BaseLeadActivity extends Activity implements
		OnClickListener {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

	// 定位
	protected LocationClient mLocClient;

	/**
	 * 注册监听器
	 */
	protected abstract void initData();

	/**
	 * 初始化
	 */
	protected abstract void initView();

	@Override
	public void onClick(View v) {

	}

	/**
	 * 设置百度地图的相关参数，精简版
	 * 
	 * @author liu
	 * @date 2014-02-26
	 */
	protected void setLocationOption() {
		LocationClientOption option = new LocationClientOption();
		option.setCoorType("bd09ll");// 返回的定位结果是百度经纬度,默认值gcj02
		option.setServiceName("com.baidu.location.service_v2.9");
		option.setPoiExtraInfo(true);
		option.setAddrType("all");
		option.setPriority(LocationClientOption.NetWorkFirst); // 设置网络优先
		option.setPoiNumber(10);
		option.disableCache(true);
		mLocClient.setLocOption(option);
	}

	/*
	 * (non-Javadoc) 百度地图销毁
	 * 
	 * @see android.app.Activity#onDestroy()
	 */
	@Override
	protected void onDestroy() {
		mLocClient.stop();
		super.onDestroy();
	}

	/** 含有标题、内容、图标、两个按钮的对话框 **/
	public AlertDialog ShowDialog(String title, String message, int icon,
			String positiveText,
			DialogInterface.OnClickListener onPositiveClickListener,
			String negativeText,
			DialogInterface.OnClickListener onNegativeClickListener) {
		AlertDialog alertDialog = new AlertDialog.Builder(this).setTitle(title)
				.setMessage(message).setIcon(icon)
				.setPositiveButton(positiveText, onPositiveClickListener)
				.setNegativeButton(negativeText, onNegativeClickListener)
				.show();
		return alertDialog;
	}

	/**
	 * defaultFinish 默认退出
	 */
	protected void defaultFinish() {
		super.finish();
	}

}
